<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link href="../static/azxcrm/css/details.css"
	th:href="@{/azxcrm/css/details.css}" rel="stylesheet" />

<body>
	<!-- 客户资料详情 -->
	<div class="layui-layer-warp">
		<div class="customer_find">
			<div class="customer_f1">
				<span class="f2">客户线索</span> <a class="f4 "
					th:text="${customerClue.isHandle} == 0? 未处理 :已处理"></a> 
			</div>
		</div>
		<div th:if="${customerInfo} != null" class="customer_table">
			<table class="table table-bordered find1">
				<tbody class="find1_tbody">
					<tr>
						<td colspan="3" class="find1_title "><span
							class="glyphicon glyphicon-exclamation-sign"></span>该用户已存在！</td>
					</tr>
					<tr>
						<td><span class="table_name">姓名：</span><span
							class="table_name2" th:text="${customerInfo.name}"></span></td>
						<td><span class="table_phone">手机号码：</span><span
							class="table_phone2" th:text="${customerInfo.cellphone}"></span></td>
							<td class="local"><span class="table_local">所在地：</span><span
							class="table_local2" th:text="${customerInfo.province}+'-'+${customerInfo.city}+'-'+${customerInfo.area}"></span></td>
					</tr>
					<tr>
						
						<td><span class="table_sex">性别：</span>
							<span th:if="${customerInfo.sex} == 0" class="table_sex2">未知</span>
							<span th:if="${customerInfo.sex} == 1" class="table_sex2">男</span>
							<span th:if="${customerInfo.sex} == 2" class="table_sex2">女</span>
						</td>
						<td class="find1_bottom"><span class="table_id">身份证号：</span><span
							class="table_id2" th:text="${customerInfo.identityNum}"></span></td>
					</tr>

				</tbody>
			</table>
		</div>
		<!-- 客户资料详情 -->
		<!-- 客户信息 -->
		<div class="customer_table2">
			<table class="table customer_table3">
				<tbody>
					<tr>
						<td colspan="4" class="pos-rel infor">客户信息</td>
					</tr>
					<tr class="table_phone2">
						<td class="phone2">姓名</td>
						<td th:text="${customerClue.customerName}"></td>
						<td class="phone2">手机号码</td>
						<td th:text="${customerClue.customerCellphone}" id="customerCellphone"></td>
					</tr>
					<tr class="table_phone2">
						<td class="phone2">性别</td>
						<td th:if="${customerClue.customerSex} == 0">未知</td>
						<td th:if="${customerClue.customerSex} == 1">男</td>
						<td th:if="${customerClue.customerSex} == 2">女</td>
						<td class="phone2">年龄</td>
						<td th:text="${customerClue.customerAge}"></td>
					</tr>
					<tr class="table_phone2">
						<td class="phone2">出生日期</td>
						<td th:text="${customerClue.customerBirth}"></td>
						<td class="phone2">身份证号</td>
						<td th:text="${customerClue.customerIdentityNum}"></td>
					</tr>
					<tr class="table_phone2">
						<td class="phone2">职位</td>
						<td th:text="${customerClue.customerJob}"></td>
						<td class="phone2">微信号</td>
						<td th:text="${customerClue.customerWechatAccount}"></td>
					</tr>
					<tr class="table_phone2">
						<td class="phone2">紧急联系人</td>
						<td th:text="${customerClue.customerEmergencyContact}"></td>
						<td class="phone2">联系号码</td>
						<td th:text="${customerClue.customerEmergencyCellphone}"></td>
					</tr>
					<tr class="table_phone2">
						<td class="phone2">所在地</td>
						<td th:text="${customerClue.customerProvince} == 请选择  ? '' : ${customerClue.customerProvince}+'-'+${customerClue.customerCity}+'-'+${customerClue.customerArea}+'-'+${customerClue.customerAddressDetail}"></td>
						<td class="phone2">采集时间</td>
						<td th:text="${customerClue.createTime}"></td>
					</tr>
					<tr class="table_phone2">
						<td class="phone2 phone3">客户背景</td>
						<td class="phone4" th:text="${customerClue.customerBackground}"></td>
					</tr>
				</tbody>
			</table>
		</div>
		<!-- 客户信息 -->
		<!-- 线索信息 -->
		<div class="customer_table4">
			<table class="table customer_table3">
				<tbody>
					<tr>
						<td colspan="4" class="pos-rel infor">线索信息</td>
					</tr>
					<tr class="table_phone2 phone3">
						<td class="phone2">线索来源</td>
						<td th:if="${customerClue.clueSource} == 1">官网PC</td>
						<td th:if="${customerClue.clueSource} == 2">官网WAP</td>
						<td th:if="${customerClue.clueSource} == 3">CRM-PC</td>
						<td th:if="${customerClue.clueSource} == 4">CRM-WAP</td>
						<td class="phone2">负责人</td>
						<td th:text="${customerClue.createBy}"></td>
					</tr>
					<tr class="table_phone2">
						<td class="phone2">线索类型</td>
						<td th:text="${customerClue.productType}" id="productType"></td>
						<td class="phone2">渠道</td>
						<td th:text="${customerClue.clueChannel} == 0 ? 未知来源  : ${customerClue.clueChannel}"></td>
					</tr>
					<tr class="table_phone2">
						<td class="phone2" th:if="${customerClue.occupancyType} != 0">入住类型</td>
						<td th:if="${customerClue.occupancyType} == 1">长住</td>
						<td th:if="${customerClue.occupancyType} == 2">短住</td>
						<td class="phone2" th:if="${customerClue.recureProject} != ''">康复项目</td>
						<td th:if="${customerClue.recureProject} != ''" th:text="${customerClue.recureProject}"></td>
					</tr>
					<tr class="table_phone2" th:if="${customerClue.tourismScale} != 0 or ${customerClue.tourismRoute} != ''">
						<td class="phone2">报团人数</td>
						<td th:text="${customerClue.tourismScale} == 0?非本类型线索:${customerClue.tourismScale}"></td>
						<td class="phone2">旅游线路</td>
						<td th:text="${customerClue.tourismRoute} == '' ? 非本类型线索 : ${customerClue.tourismRoute}"></td>
					</tr>
				</tbody>
			</table>
		</div>
		<!-- 线索信息 -->
		<!-- 历史记录 -->
		<div class="customer_table5" th:if="${dispatch!=1}">
			<h4 class="pos-rel">派单记录</h4>
			<div class="table_Height">
				<table class="table table-bordered table5_record">
					<thead>
						<tr class="table_name">
							<th>派单时间</th>
							<th>派单类型</th>
							<th>关联业务员</th>
							<th>保护期</th>
						</tr>
					</thead>
					<tbody>
						<tr th:each="dispatchList : ${dispatch}">
							<td th:text="${dispatchList.dispatchTime}"></td>
							<td th:text="${dispatchList.order.typeName}"></td>
							<td th:text="${dispatchList.user}==null ? '' : ${dispatchList.user.userName}"></td>
							<td th:text="${dispatchList.protectTime}"></td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
		<!-- 历史记录 -->
		<!-- 参课记录 -->
		<div class="customer_table6">
			<h4 class="pos-rel">参课记录</h4>
			<div class="table_Height">
				<table class="table table-bordered table5_record">
					<thead>
						<tr class="table_name">
							<th>参课时间</th>
							<th>姓名</th>
							<th>手机号码</th>
							<th>部门</th>
							<th>业务员</th>
							<th>是否本人咨询</th>
						</tr>
					</thead>
					<tbody>
						<tr th:each="customerAttendance : ${customerAttendanceList}">
							<td th:text="${customerAttendance.attendanceTime}"></td>
							<td th:text="${customerAttendance.attendCustName}"></td>
							<td th:text="${customerAttendance.cellphoneNum}"></td>
							<td th:text="${customerAttendance.dept.deptName}"></td>
							<td th:text="${customerAttendance.createBy}"></td>
							<td th:text="${customerAttendance.isOwnself} == 0?本人 : 代咨询"></td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
		<!-- 参课记录 -->

		<!-- 预约记录 -->
		<div class="customer_table7">
			<h4 class="pos-rel">预约记录</h4>
			<div class="history">
				<ul class="history_record">
					<li><a href="javascript:void(0);" onclick="js_switch(1)">二期床位</a></li>
					<li><a href="javascript:void(0);" onclick="js_switch(2)">乐享旅游</a></li>
					<li><a href="javascript:void(0);" onclick="js_switch(3)">康复项目</a></li>
				</ul>
			</div>
			<div class="table_Height appointment">
				<table id="tbody1" class="table table-bordered table5_record">
					<thead>
						<tr class="table_name">
							<th>预约时间</th>
							<th>姓名</th>
							<th>手机号码</th>
							<th>性别</th>
							<th id="ptype"></th>
							<th class="cljg">处理结果</th>
						</tr>
					</thead>
					<tbody th:each="bespeak : ${bespeakList}">
						<tr class="diss1" th:if="${bespeak.typeId}==15">
							<td th:text="${bespeak.createTime}"></td>
							<td th:text="${bespeak.customerName}"></td>
							<td th:text="${bespeak.customerCellphone}"></td>
							<td th:if="${bespeak.customerSex}==0">未知</td>
							<td th:if="${bespeak.customerSex}==1">男</td>
							<td th:if="${bespeak.customerSex}==2">女</td>
							<td th:if="${bespeak.occupancyType==1}">长住</td>
							<td th:if="${bespeak.occupancyType==2}">短住</td>
							<td th:if="${bespeak.clueOperationType} == 0">创建线索</td>
							<td th:if="${bespeak.clueOperationType} == 1">真线索</td>
							<td th:if="${bespeak.clueOperationType} == 2">无需处理</td>
							<td th:if="${bespeak.clueOperationType} == 3">丢弃</td>
						</tr>
						<tr class="diss2" th:if="${bespeak.typeId}==13">
							<td th:text="${bespeak.createTime}"></td>
							<td th:text="${bespeak.customerName}"></td>
							<td th:text="${bespeak.customerCellphone}"></td>
							<td th:if="${bespeak.customerSex}==0">未知</td>
							<td th:if="${bespeak.customerSex}==1">男</td>
							<td th:if="${bespeak.customerSex}==2">女</td>
							<td th:text="${bespeak.tourismRoute}"></td>
							<td th:if="${bespeak.clueOperationType} == 0">创建线索</td>
							<td th:if="${bespeak.clueOperationType} == 1">真线索</td>
							<td th:if="${bespeak.clueOperationType} == 2">无需处理</td>
							<td th:if="${bespeak.clueOperationType} == 3">丢弃</td>
						</tr>
						<tr class="diss3" th:if="${bespeak.typeId}==14">
							<td th:text="${bespeak.createTime}"></td>
							<td th:text="${bespeak.customerName}"></td>
							<td th:text="${bespeak.customerCellphone}"></td>
							<td th:if="${bespeak.customerSex}==0">未知</td>
							<td th:if="${bespeak.customerSex}==1">男</td>
							<td th:if="${bespeak.customerSex}==2">女</td>
							<td th:text="${bespeak.recureProject}"></td>
							<td th:if="${bespeak.clueOperationType} == 0">创建线索</td>
							<td th:if="${bespeak.clueOperationType} == 1">真线索</td>
							<td th:if="${bespeak.clueOperationType} == 2">无需处理</td>
							<td th:if="${bespeak.clueOperationType} == 3">丢弃</td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
		<!-- 预约记录 -->

		<!-- 沟通记录 -->
		<form id="form-customerDetails-add">
		<div class="item_form" th:if="${customerClue.clueOperationType == 0}">
			<h4 class="pos-rel">沟通记录</h4>
			<div class="haha">
				<div class="form_warp clearfix">
					<div class="select_left">
						<label for="">客户意向:</label> 
						<select name="typeId" id="typeId"  class="cms-form-select">
							<option value="" selected="selected">请选择</option>
							<option th:each="product : ${productList}"
							th:value="${product.dictCode}"
							th:text="${product.dictLabel}"></option>
						</select>
					</div>
					<div class="select_right">
						<label for="">问题归类:</label> 
						<select name="questionId" class="cms-form-select" onchange="changeSelect()">
							<option value="" selected="selected">请选择</option>
							<option th:each="question : ${questionList}"
							th:value="${question.dictCode}"
							th:text="${question.dictLabel}"></option>
						</select>
					</div>
					<div class="select_left problem">
						<label for="">问题细分:</label>
						<select class="form-control problem2" name="detailId" id="detailId"></select>
					</div>
				</div>
				<div class="select_text">
					<label for="">沟通内容:</label>
					<textarea name="content" id="content" class="form-control" rows="3"
						style="resize: none"></textarea>
				</div>
				<div class="select_text">
					<label for="">客服建议:</label>
					<textarea name="suggestion" id="suggestion" class="form-control" rows="3"
						style="resize: none"></textarea>
				</div>
			</div>
		</div>
		<!-- 沟通记录 -->

		<!-- 客服接待记录 -->
		<div class="customer_table8" th:if="${customerClueCommunication != null}">
			<h4 class="pos-rel">客服接待记录</h4>
			<div class="commutation">
				<div class="table_Height">
					<table class="table table-bordered table5_record">
						<thead>
							<tr class="table_name">
								<th>沟通时间</th>
								<th>客户意向</th>
								<th>问题归类</th>
								<th>问题细分</th>
								<th>是否本人</th>
								<th>客服</th>
							</tr>
						</thead>
						<tbody>
							<tr class="table_name">
								<td th:text="${customerClueCommunication}==null?'':${customerClueCommunication.createTime}"></td>
								<td th:text="${customerClueCommunication}==null?'':${customerClueCommunication.typeName}"></td>
								<td th:text="${customerClueCommunication}==null?'':${customerClueCommunication.questionType}"></td>
								<td th:text="${customerClueCommunication}==null?'':${customerClueCommunication.detailName}"></td>
								<td th:if="${customerClue.isOwnself} == 0">未选择</td>
								<td th:if="${customerClue.isOwnself} == 1">本人</td>
								<td th:if="${customerClue.isOwnself} == 2">代咨询</td>
								<td th:text="${customerClueCommunication}==null?'':${customerClueCommunication.createBy}"></td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="text_hide">
					<div class="text_info">
						<span>沟通内容：</span>
						<textarea class="form-control" readonly="readonly" rows="3" style="resize: none" 
						th:text="${customerClueCommunication}==null?'':${customerClueCommunication.content}"></textarea>
					</div>
					<div class="text_info2">
						<span>客服建议：</span>
						<textarea class="form-control" readonly="readonly" rows="3" style="resize: none" 
						th:text="${customerClueCommunication}==null?'':${customerClueCommunication.suggestion}"></textarea>
					</div>
				</div>
			</div>
		</div>
		<!-- 客服接待记录 -->


		<!-- 操作处理 -->
		<div class="handing clearfix" th:if="${customerClue.clueOperationType == 0}">
				<div class="handing_left">
					<label class="label_intention" for="">操作处理：</label> 
					<select name="clueOperationType" id="clueOperationType" class="cms-form-select label_select">
						<option value="" selected="selected">请选择</option>
						<option value="1">创建订单</option>
						<option value="2">无需处理</option>
						<option value="3">丢弃</option>
					</select>
				</div>

				<div class="handing_input">
					<label class="radio-inline">是否本人：</label> 
					<span><input type="radio" name="isOwnself" class="label_left"
						value="1">本人</span> 
					<span><input type="radio" name="isOwnself" class="label_right" 
						value="2">代咨询预约</span>
				</div>
				<input type="hidden" name="clueId" th:value="${customerClue.clueId}">
				<input type="hidden" name="isHandle" th:value="1">
			<div class="handing_btn">
				<input class="handing_btn_left" type="submit">确定</input>
			</div>
		</div>
		</form>
	</div>
	<div th:include="include::footer"></div>
	<!-- 操作处理 -->
	<script src="/js/jquery-ui-1.10.4.min.js"
		th:src="@{/js/jquery-ui-1.10.4.min.js}"></script>
	<script src="/ajax/libs//datapicker/bootstrap-datepicker.js"
		th:src="@{/ajax/libs//datapicker/bootstrap-datepicker.js}"></script>
	<script src="/azxcrm/module/customerClue/details.js"
		th:src="@{/azxcrm/module/customerClue/details.js}"></script>
</body>
</html>
<script>
	$(function() {
		$('#myTab li:eq(0) a').tab('show');
		$(".text-red").click(
				function() {
					if ($(this).text() == "查看更多") {
						$(this).text("点击收起");
						$(this).parent(".btnBox").siblings(".table_Height")
								.addClass("autoHeight");
					} else {
						$(this).text("查看更多");
						$(this).parent(".btnBox").siblings(".table_Height")
								.removeClass("autoHeight");
					}
				})
		// $(".details").click(function(){
		//     if($(this).text()=="详情"){
		//         $(this).text("收起");
		//         $(".text_hide").show();
		//     }else{
		//         $(this).text("详情");
		//         $(".text_hide").hide();
		//     } 
		// })
	});
</script>